package com.amit.jdbc.mysql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class JDBCUTIL {
	
	static Connection con;
	
	static
	{
		try {
			Class.forName("com.mysql.jdbc.Driver");
			Class.forName("oracle.jdbc.driver.OracleDriver");
			
		} catch (Exception e) {
			
			e.printStackTrace();
		}
	}

	public static Connection getmysqlconnection() {
		
 
try {
	con = DriverManager.getConnection("jdbc:mysql://localhost:3306/amit007","root","root");
	
     }

catch (Exception e) {
	
	
	e.printStackTrace();
}
		
		return con;
	}

	
	public static Connection getoracleconnection() throws SQLException {
		
		 
		Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","amit");
			
				
				return con;
			}


	public static void cleanup(Statement st,Connection  con) {
		try {
			if(st!=null)
			st.close();
			if(con!=null)
				con.close();
		} catch (Exception e) {
		
			e.printStackTrace();
		}
		
	}

	
}
